/**
 * api接口管理， 全部以$开头
 * @author terrfly
 * @site https://www.jeequan.com
 * @date 2021/12/17 09:57
 */

import http from "./http.js"
import appConfig from "../config/appConfig.js"

/* 密码登录 */
export function $login(data) {
  return http.req("/api/anon/auth/validate", data, "POST")
}

/* 验证码登录 */
export function $phoneCodeLogin(data) {
  return http.req("/api/anon/auth/phoneCode", data, "POST")
}

/* 退出登录 */
export function $logout() {
  return http.req("/api/current/logout", null, "POST")
}

/* 注册发送短信验证码 */
export function $sendMessage(data) {
  return http.req("/api/anon/sms/code", data, "POST")
}

/* 找回密码 */
export function $retrievePassword(data) {
  return http.req("/api/anon/cipher/retrieve", data, "POST")
}

/* 修改密码 */
export function $modifyPwd(data) {
  return http.req("/api/current/modifyPwd", data, "PUT")
}
// 更新支付密码
export function $updateAgentSipw(data) {
  return http.req("/api/agentConfig/agentSipw", data, "PUT")
}
// 验证原支付密码是否正确
export function $isAgentSipw(data) {
  return http.req("/api/agentConfig/agentSipwValidate", data, "POST")
}
// 验证是否有密码
export function $isSipw() {
  return http.req("/api/agentConfig/hasSipwValidate", "GET")
}

/* 获取公司信息 */
export function $getCompanyInfo(data) {
  return http.list("/api/anon/siteInfos", data)
}
/* 获取个人信息 */
export function $getUserInfo(data) {
  return http.list("/api/current/user")
}
/* 修改个人信息 */
export function $modifyUser(data) {
  return http.req("/api/current/user", data, "PUT")
}

/* 获取密码规则 */
export function $getPasswordRules() {
  return http.req("/api/anon/cipher/pwdRulesRegexp", "GET")
}
//获取云打印机/云喇叭列表
export function $getDeviceList(data) {
  return http.list("/api/store/device", data)
}

//获取云打印机/云喇叭详情
export function $getDeviceDetail(bizId) {
  return http.req("/api/store/device/" + bizId, "GET")
}

//修改云打印机/云喇叭详情
export function $updateDeviceDetail(bizId, data) {
  return http.updateById("/api/store/device", bizId, data)
}

//云打印机/云喇叭绑定
export function $bindDevice(bizId, data) {
  return http.updateById("/api/store/device/bind", bizId, data)
}
//云打印机/云喇叭解绑
export function $unBind(bizId) {
  return http.req("/api/store/device/unbind/" + bizId, undefined, "POST")
}

// 通道列表
export function $getmchApplymentList(data) {
  return http.list("/api/mchApplyments", data)
}

// 隐私政策与服务协议
export function $getTreaty(data) {
  return http.list("/api/anon/treaty", data)
}

// 新增门店
export function $addMchStore(data) {
  return http.add("/api/mchStore", data)
}

// 修改门店
export function $updateMchStore(storeId, data) {
  return http.updateById("/api/mchStore", storeId, data)
}

export function $rateConfig(infoId) {
  return http.req("/api/payConfig/ifCodes", { infoId, configMode: "agentApplyment" }, "GET")
}

/* 版本检测 */
export function $versionDetection(data) {
  return http.list("/api/anon/clientVersion/versionInfo", data)
}

/* 获取上传form信息 */
export function $ossFilesForm(data) {
  return http.req("/api/ossFiles/form", data, "POST")
}

/** 费率配置： 获取全部接口 */
export function $getPayConfigIfcodes(infoId, configMode, ifName) {
  return http.req("/api/payConfig/ifCodes", { infoId, configMode, ifName }, "GET")
}

/* 发起进件 */
export function $mchApplyments(data) {
  return http.req("/api/mchApplyments", data, "POST")
}

/* 保存草稿 */
export function $updateApply(data, params) {
  return http.updateById("/api/mchApplyments", data, params)
}

/* 获取个人信息 */
export function $userInfo(data) {
  return http.req("/api/current/user", data, "GET")
}

/* 查询进件详情 */
export function $mchApplymentsInfo(applyId, originData) {
  return http.req("/api/mchApplyments/" + applyId, originData ? { originData } : undefined)
}

/* 斗拱微信实名认证 */
export function $dgpayWxRealName(applyId, reqParams) {
  return http.req("/api/mchApplyments/dgpayConfigOpen/" + applyId, reqParams, "POST")
}

/* 职能读取 */
export function $mergeApplyDetailInfos(mchNo) {
  return http.req("/api/mchApplyments/mergeApplyDetailInfos/" + mchNo, "GET")
}

/* 银盛  上传图片 */
export function $yspayUpload(applyId, data) {
  return http.req("/api/mchApplyments/yspayUpload/" + applyId, data, "POST")
}

/* 银盛  新增支付类型 */
export function $ysPayRateConfig(applyId, reqParams) {
  return http.req("/api/mchApplyments/ysPayRateConfig/" + applyId, reqParams, "POST")
}

/* OCR图片识别 */
export function $imgInfoDetail(data) {
  return http.req("/api/imgInfo/detail", data, "POST")
}

/* 统计数据页 */
export function $statistics(data) {
  return http.req("/api/stat/index", data, "GET")
}
/* 获取商户列表*/
export function $getMerList(data) {
  return http.list("/api/mchInfo", data)
}
/* 添加商户*/
export function $addMer(data) {
  return http.req("/api/mchInfo", data, "POST")
}
/* 修改商户*/
export function $editMer(data, params) {
  return http.updateById("/api/mchInfo", data, params)
}
/*获取地图key */
export function $mapKey() {
  return http.req("/api/mchStore/mapConfig", "GET")
}
/* 查找商户*/
export function $findMer(data) {
  return http.getById("/api/mchInfo", data)
}
/*请求静态码列表*/
export function $getQRcodeList(data) {
  return http.list("/api/mchQrCodes", data)
}

/*请求静态码详情*/
export function $getQRcodeDetail(qrcId) {
  return http.list("/api/mchQrCodes/" + qrcId)
}

/*更改静态码状态*/
export function $upDateQRcodeList(data, qrcId) {
  return http.updateById("/api/mchQrCodes", data, qrcId)
}

/*码牌绑定门店*/
export function $qrcodeBind(data, qrcId) {
  return http.updateById("/api/mchQrCodes/bind", data, qrcId)
}

/*请求代理商列表*/
export function $getAgentList(data) {
  return http.list("/api/subAgents", data)
}
/*请求代理商列表*/
export function $editAgent(data, params) {
  return http.updateById("/api/subAgents", data, params)
}
/* 查找代理商*/
export function $findAgent(data) {
  return http.getById("/api/subAgents", data)
}
/* 添加代理商*/
export function $addAgent(data) {
  return http.req("/api/subAgents", data, "POST")
}
/* 通过代理商获取统计数据*/
export function $getStatic(params) {
  return http.list("/api/stat/index", params)
}
/* 订单列表 */
export function $getOrderList(data) {
  return http.list("/api/payOrder", data)
}
/* 订单详情 */
export function $getPayOrder(data) {
  return http.getById("/api/payOrder", data)
}
/* 退款列表 */
export function $getRefundOrder(data) {
  return http.getById("/api/refundOrder", data)
}
/* 退款列表 */
export function $getRefundList(data) {
  return http.list("/api/refundOrder", data)
}
/*请求码牌详情*/
export function $getQRcode(data) {
  return http.getById("/api/mchQrcShells/viewByQrc", data)
}
/** 商户门店管理 **/
export function $getMchStoreList(data) {
  return http.list("/api/mchStore", data)
}
/** 商户应用列表 **/
export function $getMchAppList(data) {
  return http.list("/api/mchApps", data)
}
/** 团队列表 **/
export function $getTeams(data) {
  return http.list("/api/userTeams", data)
}
/* 获取今天、昨天笔数统计 */
export function $getPayDayCount(data) {
  return http.list("/api/mainChart/payDayCount", data)
}

/* 提现记录*/
export function $getCashout(data) {
  return http.list("/api/cashout", data)
}
/* 提现记录详情 */
export function $getCashoutDetail(data) {
  return http.getById("/api/cashout", data)
}

/** 进件列表 **/
export function $applyList(params) {
  return http.list("/api/mchApplyments", params)
}
/* 创建团队*/
export function $addTeam(data) {
  return http.req("/api/userTeams", data, "POST")
}

/** 进件渠道列表 **/
export function $payIfDefines(params) {
  return http.list("/api/payIfDefines", params)
}

/** 进件前预先检查，避免重复进件 */
export function $applyPreCheck(mchNo, ifCode) {
  return http.req("/api/mchApplyments/applyPreCheck/" + mchNo + "/" + ifCode, null, "GET")
}

/* 查询合同信息 */
export function $getMchApplymentChannelSignInfo(applyId) {
  return http.getById("/api/mchApplyments/channelSignInfo", applyId)
}

/* 开户意愿查询 */
export function $getMchApplymentWxOpenInfo(applyId) {
  return http.getById("/api/mchApplyments/channelWxOpenInfo", applyId)
}

/* 添加拓展员*/
export function $addDev(data) {
  return http.add("/api/sysUsers", data)
}
//拓展员详情
export function $devDetail(data) {
  return http.getById("/api/sysUsers", data)
}
//修改拓展员
export function $editDev(data, params) {
  return http.updateById("/api/sysUsers", data, params)
}
//拓展员列表
export function $getDev(data) {
  return http.list("/api/sysUsers", data)
}
//发起提现
export function $putApplition(data) {
  return http.add("/api/cashout/sett", data)
}
/* 订单详情 */
export function $getDevDetail(data) {
  return http.list("/api/stat/userChart", data)
}

/** 费率配置： 获取 支付方式 */
export function $getRateConfigSavedMapData(infoId, configMode, ifCode) {
  return http.req("/api/rateConfig/savedMapData", {
    infoId,
    configMode,
    ifCode,
  })
}

/** 费率配置： 获取 支付方式 */
export function $getRateConfigPayways(infoId, configMode, ifCode) {
  return http.req("/api/rateConfig/payways", { infoId, configMode, ifCode })
}
//获取账户信息
export function $getAcountInfo() {
  return http.req("/api/mainChart", "GET")
}
//获取提现费率
export function $getAmountFee() {
  return http.req("/api/cashout/paywayFee", "GET")
}

/** 收付通进件  动态获取银行支行列表 */
export function $bankBranchList(mchNo, ifCode, params) {
  return http.req("/api/mchApplyments/bankList/" + mchNo + "/" + ifCode, params)
}

/* 选择银行 */
export function $bankCode(ifCode, data) {
  return http.req(`/api/mchApplyments/bankCode/${ifCode}`, data)
}

// 辅助终端设备 列表
export function $terminalList(data) {
  return http.list("/api/mchTerminals", data)
}

// 辅助终端设备详情
export function $terminalInfo(id) {
  return http.getById("/api/mchTerminals", id)
}

// 删除辅助终端设备
export function $delTerminal(trmId) {
  return http.delById("/api/mchTerminals", trmId)
}

/** 辅助终端设备  报备信息集合 */
export function $getMchTermChannelBindInfos(trmId) {
  return http.req("/api/mchTerminals/channelBindInfos/" + trmId)
}

/** 接口报备 */
export function $mchTermChannelSendup(trmId, ifCode, state) {
  return http.req("/api/mchTerminals/channelSendup/" + trmId, { ifCode, state }, "POST")
}

/** 新增 辅助终端设备 */
export function $addTerminal(data) {
  return http.add("/api/mchTerminals", data)
}

/** 更新 辅助终端设备 */
export function $updateTerminal(id, data) {
  return http.updateById("/api/mchTerminals", id, data)
}

/** 辅助终端设备 更新默认设备 */
export function $updateMchTermDefault(trmId, defaultFlag) {
  return http.req("/api/mchTerminals/trmDefaults", { trmId, defaultFlag }, "PUT")
}

/* 富友电子协议生成 */
export function $elecContractGenerate(applyId) {
  return http.req("/api/mchApplyments/elecContractGenerate/" + applyId, {}, "POST")
}

/* 富友电子协议签署 */
export function $elecContractSign(applyId) {
  return http.req("/api/mchApplyments/elecContractSign/" + applyId, {}, "POST")
}

/* 富友  上传图片 提交审核 */
export function $fuiouUpload(applyId) {
  return http.req("/api/mchApplyments/fuiouUpload/" + applyId, {}, "POST")
}
/*公告列表*/
export function $getNoticeList(data) {
  return http.list("/api/sysArticles", data)
}
//公告详情
export function $noticeDetail(data) {
  return http.getById("/api/sysArticles", data)
}

/* 银联前置  新增支付类型 */
export function $payConfAdd(applyId, reqParams) {
  return http.req("/api/mchApplyments/payConf/" + applyId, reqParams, "POST")
}
/*拉卡拉sass 支行列表*/

export function $lklGetBankList(areaCode) {
  return http.req("/api/mchApplyments/getLklBankList/" + areaCode)
}
// 扫码登录
export function $scanCodeLogin(data) {
  return http.req("/api/current/qrcode/login", data, "post")
}
// 注册
export function $register(data) {
  return http.req("/api/anon/register/agentRegister", data, "post")
}
// 完善资料
export function $auditInfo(data) {
  return http.req("/api/sysUsers/audit", data, "PUT")
}
// 获取用户状态
export function $getMainUserInfo() {
  return http.req("/api/mainChart", "GET")
}
/* 创建团队*/
export function $editTeam(data) {
  return http.req("/api/userTeams/" + data.teamId, data, "PUT")
}
// 查询门店详情
export function $storeDetails(storeId) {
  return http.req("/api/mchStore/" + storeId, "GET")
}
// 删除 拓展员
export function $delSysUser(sysId) {
  return http.delById("/api/sysUsers", sysId)
}
// 删除商户
export function $delMchInfo(mchId) {
  return http.delById("/api/mchInfo", mchId)
}
// 删除代理商
export function $delAgent(agentId) {
  return http.delById("/api/subAgents", agentId)
}
// 删除门店
export function $delStore(storeId) {
  return http.delById("/api/mchStore", storeId)
}
/* 查询进件接口的最新状态 */
export function $getMchApplymentChannelState(applyId) {
  return http.req("/api/mchApplyments/channelState/" + applyId, "GET")
}
/*应用列表*/
export function $getAppList(params) {
  return http.list("/api/mchApps", params)
}
/*修改应用*/
export function $editApp(data) {
  return http.updateById('/api/mchApps', data.appId, data)
}
/*应用详情*/
export function $getAppDetails(appId) {
  return http.getById("/api/mchApps", appId)
}
/*获取应用支付配置列表*/
export function $getPayConfig(params) {
  return http.list("/api/mch/payPassages", params)
}
/*获取可配置的支付渠道*/
export function $getPayChannelList(appId, wayCode) {
  return http.req(`/api/mch/payPassages/availablePayInterface/${appId}/${wayCode}`, {}, "GET")
}
/*保存应用的支付渠道*/
export function $savePayConfig(data) {
  return http.req('/api/mch/payPassages/mchPassage', data, "POST")
}

/*收回Or划拨接口*/
export function $allotORtakeBack(data) {
  return http.req('/api/store/device/allotDevice', data, 'POST')
}
/*码牌划拨收回*/

export function $qrCodeAllotORTakeBack(data) {
  return http.req('/api/mchQrCodes/allotQrc', data, 'POST')
}
/*刷脸设备*/
export function $faceList(params) {
  return http.list('/api/store/device', params)
}
/*刷脸设备详情*/
export function $faceDetails(devId) {
  return http.getById('/api/store/device', devId)
}
/*修改刷脸设备状态*/
export function $updateFace(data) {
  return http.updateById('/api/store/device', data.deviceId, { state: data.state })
} 
/* 获取广告接口*/ 
export function $adList(params){
  return http.req('/api/advert/appAdvert', params,'GET')
}
// 获取上传图片 大小
export function $getUploadImgSize(){
  return http.req('/api/defaultConfig',{},"GET")
}
// 新增商户应用
export function $addApp(data){
  return http.req('/api/mchApps',data,"POST")
}